package com.disputemanager.listeners;

import java.io.File;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.log4j.Logger;

import com.disputemanager.config.Constants;

 
public class AppServletContextListener implements ServletContextListener{
	
	private final Logger LOGGER = Logger.getLogger(AppServletContextListener.class);
 
	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		
		File folder = new File(Constants.DocumentRepository);
		if(!folder.exists()){
			folder.mkdirs();
			LOGGER.debug("Document Repository Set = "+Constants.DocumentRepository);
		}
		
		LOGGER.info("DisputeManager has started.");	
                
	}
	
	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		LOGGER.info("DisputeManager has stopped.");
	}

}